/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.just.dusin.ooii.core;

import java.util.ArrayList;
import java.util.List;

import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.security.AuthenticationUser;
import org.apache.activemq.security.SimpleAuthenticationPlugin;

/**
 *
 * @author Administrator
 */
public class MqServer {

    private String brokerUrl = "tcp://127.0.0.1:61616";    
    private BrokerService broker;
    public void start() throws Exception {
        createBroker();        
    }
    private void createBroker() throws Exception {
        broker = new BrokerService();
        broker.setPersistent(true);
         broker.setDataDirectory("data/");
        broker.setUseJmx(false);
        broker.addConnector(brokerUrl);
        broker.start();
    }
    public void stop() throws Exception {       
        broker.stop();
    }

    public String getBrokerUrl() {
        return brokerUrl;
    }

    public void setBrokerUrl(String brokerUrl) {
        this.brokerUrl = brokerUrl;
    }
    
}
